package com.orhon.smartcampus.modules.base.mm;

import com.orhon.smartcampus.basicComponents.GQLLang;
import com.orhon.smartcampus.modules.base.entity.Schools;
import com.orhon.smartcampus.modules.teacher.entity.TInformation;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

@Mapper
public interface LangMapper {

    LangMapper MAPPER = Mappers.getMapper(LangMapper.class);

    @Mapping( target = "zh" , expression = "java( com.orhon.smartcampus.basicComponents.GQLLang.getZhs(jsonStr))")
    @Mapping( target = "en" , expression = "java( com.orhon.smartcampus.basicComponents.GQLLang.getEns(jsonStr))")
    @Mapping( target = "mn" , expression = "java( com.orhon.smartcampus.basicComponents.GQLLang.getMns(jsonStr))")
    GQLLang mapLang(String jsonStr);

    @Named("getTeacherId")
    default Long getTeacherId(TInformation tInformation){
        return tInformation.getId();
    }
    @Named("getSchoolId")
    default Long getSchoolId(Schools schools){
        return schools.getId();
    }
}
